 var exportExcel = document.getElementById("exportExcel");
 exportExcel.onclick = function (aa) {
     var urlinfo = window.location.href; //获取当前页面的url
     var len = urlinfo.length; //获取url的长度
     var offset = urlinfo.indexOf("?"); //设置参数字符串开始的位置
     var newsidinfo = urlinfo.substr(offset, len)//取出参数字符串 这里会获得类似“id=1”这样的字符串
     var newsids = newsidinfo.split("="); //对获得的参数字符串按照“=”进行分割
     //var xzq = (newsids[1]); //得到参数值
     var xzq = (newsids[1]); //得到参数值
     if (xzq.match('&'))
         xzq = xzq.split('&')[0];
     var xzqname = newsids[0]; //得到参数名字
     var param = exportExcel.outerHTML;
     var a = param.split('(');
     var b = a[1].split(')')[0];
     $.ajax({
         type: "post",
         async: false,
         url: "/Ajax.ashx",
         data: //发送到服务器的参数
                    {
                    stype: "导出成果表格",
                    mtype: '' + b + '',
                    xzq: xzq
                },
         datatype: "json",
         success: function (result) {
             //            var exportExcel = document.getElementById("exportExcel");
             var str = result.split('||');
             if (xzq.length == 4)
//                 exportExcel.setAttribute("onclick", "javascript:window.open('/file/第三次全国国土调查成果包/" + xzq + "00/" +
//                            str[0] + "(" + xzq + "00)第三次国土调查成果/基础数据包/汇总表格/" + xzq + "00" + str[1] + ".xlsx');");
                 //javascript:window.open('/file/第三次全国国土调查成果包/" + xzq + "00/" +str[0] + "(" + xzq + "00)第三次国土调查成果/基础数据包/汇总表格/" + xzq + "00" + str[1] + ".xlsx');
                 window.location.href = "/file/第三次全国国土调查成果包/" + xzq + "00/" +str[0] + "(" + xzq + "00)第三次国土调查成果/基础数据包/汇总表格/" + xzq + "00" + str[1] + ".xlsx";
             else
//                 exportExcel.setAttribute("onclick", "javascript:window.open('/file/第三次全国国土调查成果包/" + xzq +
//                            "/" + str[0] + "(" + xzq + ")第三次国土调查成果/基础数据包/汇总表格/(" + xzq + ")" + str[1] + ".xlsx');");
                 javascript: window.open("/file/第三次全国国土调查成果包/" + xzq + "/" + str[0] + "(" + xzq + ")第三次国土调查成果/基础数据包/汇总表格/(" + xzq + ")" + str[1] + "." + str[2].split(".")[1]);
         },
         error: function (err) {
             if (err.status == 405)
                 top.location.href = '/';
         }
     });
 }
		
		var theTable = document.getElementById("table2");
var totalPage = document.getElementById("spanTotalPage");
var pageNum = document.getElementById("spanPageNum");
var spanPre = document.getElementById("spanPre");
var spanNext = document.getElementById("spanNext");
var spanFirst = document.getElementById("spanFirst");
var spanLast = document.getElementById("spanLast");
var numberRowsInTable = theTable.rows.length;
var pageSize = 8;
var page = 1;
//下一页
function next() {
    hideTable();
    currentRow = pageSize * page;
    maxRow = currentRow + pageSize;
    if (maxRow > numberRowsInTable) maxRow = numberRowsInTable;
    for (var i = currentRow; i < maxRow; i++) {
        theTable.rows[i].style.display = '';
    }
    page++;
    if (maxRow == numberRowsInTable) { nextText(); lastText(); }
    showPage();
    preLink();
    firstLink();
}
//上一页
function pre() {
    hideTable();
    page--;
    currentRow = pageSize * page;
    maxRow = currentRow - pageSize;
    if (currentRow > numberRowsInTable) currentRow = numberRowsInTable;
    for (var i = maxRow; i < currentRow; i++) {
        theTable.rows[i].style.display = '';
    }
    if (maxRow == 0) { preText(); firstText(); }
    showPage();
    nextLink();
    lastLink();
}
//第一页
function first() {
    hideTable();
    page = 1;
    for (var i = 0; i < pageSize; i++) {
        theTable.rows[i].style.display = '';
    }
    showPage();
    preText();
    nextLink();
    lastLink();
}
//最后一页
function last() {
    hideTable();
    page = pageCount();
    currentRow = pageSize * (page - 1);
    for (var i = currentRow; i < numberRowsInTable; i++) {
        theTable.rows[i].style.display = '';
    }
    showPage();
    preLink();
    nextText();
    firstLink();
}
function hideTable() {
    for (var i = 0; i < numberRowsInTable; i++) {
        theTable.rows[i].style.display = 'none';
    }
}
function showPage() {
    pageNum.innerHTML = page;
}
//总共页数
function pageCount() {
    var count = 0;
    if (numberRowsInTable % pageSize != 0) count = 1;
    return parseInt(numberRowsInTable / pageSize) + count;
}
//显示链接
function preLink() { spanPre.innerHTML = "<a href='javascript:pre();' class='paging' style='color:white;text-decoration:none;'>上一页</a>"; }
function preText() { spanPre.innerHTML = "上一页"; }
function nextLink() { spanNext.innerHTML = "<a href='javascript:next();' class='paging' style='color:white;text-decoration:none;'>下一页</a>"; }
function nextText() { spanNext.innerHTML = "下一页"; }
function firstLink() { spanFirst.innerHTML = "<a href='javascript:first();' class='paging' style='color:white;text-decoration:none;'>首页</a>"; }
function firstText() { spanFirst.innerHTML = "首页"; }
function lastLink() { spanLast.innerHTML = "<a href='javascript:last();' class='paging' style='color:white;text-decoration:none;'>末页</a>"; }
function lastText() { spanLast.innerHTML = "末页"; }
//隐藏表格
function hide() {
    for (var i = pageSize; i < numberRowsInTable; i++) {
        theTable.rows[i].style.display = 'none';
    }
    totalPage.innerHTML = pageCount();
    pageNum.innerHTML = '1';
    nextLink();
    lastLink();
}
hide();